<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Ajax异步交互</title>
</head>
<body>

</body>
<script src="js/jquery-3.3.1.min.js"></script>
<script>
    /*
    *  1、单个数据传递
    *  2、json格式数据：必须制定文档类型 contentType:'application/json;charset=utf-8'
    *  3、key=value格式数据
    * */
    $.ajax({
        type:'post',
        url:'ajax/test3',
        contentType:'application/json;charset=utf-8',
        data:'{"username":"admin","age":18}',
        //data:'username=manage&age=18',
        success:function (data) {
            alert("ok"+data);
        },
        error:function () {
            alert("error");
        }
    });
</script>
</html>